<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head>
	<base href="<%=basePath %>" />
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>Bootstrap Demo</title>
	
	<jsp:include page="../common/include.jsp"></jsp:include>

</head>
<body>
   	<input type="text" id="msg"/><br/>
   	<input type="submit" id="send"/><br/>
   	<div id="text">
   	
   	</div>
	<script type="text/javascript">
	var ws;
	$(function() {
		ws = new WebSocket("ws://localhost:8080/flash-deploy/msgServer");
		ws.onopen = function() {
			
		};
		ws.onmessage = function(event) {
			$('#text').append(event.data);
		};
		ws.onclose = function() {
			
		};
		ws.onerror = function() {
			
		};
		
		$('#send').click(function() {
			var msg = $('#msg').val();
			ws.send(msg);
		});
	});
	</script>
</body>
</html>